package com.huixh.train.business.enums;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

/**
 * @author huixh
 */
public enum SeatColEnum {
    /**
     * 座位位置
     */

    YDZ_A("A", "A", "1"),

    YDZ_C("C", "C", "1"),

    YDZ_D("D", "D", "1"),

    EDZ_A("A", "A", "2"),

    EDZ_B("B", "B", "2"),

    EDZ_C("C", "C", "2"),

    EDZ_D("D", "D", "2"),

    EDZ_F("F", "F", "2"),

    RW_A("A", "A", "4"),

    RW_B("B", "B", "4"),

    RW_C("C", "C", "4"),

    RW_D("D", "D", "4"),

    YW_A("A", "A", "5"),

    YW_B("B", "B", "5"),

    YW_C("C", "C", "5"),

    YW_D("D", "D", "5"),

    YW_E("E", "E", "5"),

    YW_F("F", "F", "5"),



    ;
    /**
     * 编码
     */
    private String code;
    /**
     * 描述
     */
    private String desc;
    /**
     * 类型
     */
    private String type;

    SeatColEnum(String code, String desc, String type) {
        this.code = code;
        this.desc = desc;
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public static List<SeatColEnum> getSeatColEnumList(String type) {
        ArrayList<SeatColEnum> list = new ArrayList<>();
        EnumSet<SeatColEnum> seatColEnums = EnumSet.allOf(SeatColEnum.class);

        seatColEnums.forEach(seatColEnum -> {
            if (seatColEnum.getType().equals(type)) {
                list.add(seatColEnum);
            }
        });

        return list;
    }

    /**
     * 根据类型获取列
     * @param type 类型
     * @return 列
     */
    public static List<SeatColEnum> getColsByType(String type){
        ArrayList<SeatColEnum> list = new ArrayList<>();
        EnumSet<SeatColEnum> seatColEnums = EnumSet.allOf(SeatColEnum.class);

        seatColEnums.forEach(seatColEnum -> {
            if (seatColEnum.getType().equals(type)) {
                list.add(seatColEnum);
            }
        });

        return list;
    }
}
